package com.nsn.das.midas.model.mml.data;

import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.nsn.das.midas.model.component.Build;
import com.nsn.das.midas.model.component.NetworkElement;
import com.nsn.das.midas.model.component.RevisionHistory;
import com.nsn.das.midas.model.embedded.State;
import com.nsn.das.midas.model.embedded.Status;
import com.nsn.das.midas.model.embedded.Version;
import com.nsn.das.midas.model.mml.letter.MMLClassLetter;
import com.nsn.das.midas.model.user.DASUser;

@Entity
@Table(name = "mml_class_data")
public class MMLClassData extends MMLData{
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="class_letter_id")
	private MMLClassLetter classLetter;//CDClass
	
	@Embedded
	private State state;//CDState
	private boolean grammarChecked;//Grammar
	private Date acceptedDate;//CDAcceptedDate
	private String menuText;//CDENMenuText
	@ManyToMany(fetch=FetchType.LAZY)
	private Set<NetworkElement> networkElements;//CDNetworkElement
	private String application;//CDApplication
	@ManyToMany(fetch=FetchType.LAZY)
	private Set<Build> builds;//CDPackage,CDRelease
	@Embedded
	private Status status;//CDStatus
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="author_id")
	private DASUser author;//CDAuthor,CDEmail
	private Date createdAt;//CDDate
	@Embedded
	private Version version;//CDVersion
	@OneToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
	private List<RevisionHistory> histories;//Comments,RevisionHistory

	public MMLClassLetter getClassLetter() {
		return classLetter;
	}
	public void setClassLetter(MMLClassLetter classLetter) {
		this.classLetter = classLetter;
	}
	public State getState() {
		return state;
	}
	public void setState(State state) {
		this.state = state;
	}
	public boolean isGrammarChecked() {
		return grammarChecked;
	}
	
	public void setGrammarChecked(boolean grammarChecked) {
		this.grammarChecked = grammarChecked;
	}
	public Date getAcceptedDate() {
		return acceptedDate;
	}
	public void setAcceptedDate(Date acceptedDate) {
		this.acceptedDate = acceptedDate;
	}
	public String getMenuText() {
		return menuText;
	}
	public void setMenuText(String menuText) {
		this.menuText = menuText;
	}
	public Set<NetworkElement> getNetworkElements() {
		return networkElements;
	}
	public void setNetworkElements(Set<NetworkElement> networkElements) {
		this.networkElements = networkElements;
	}
	public String getApplication() {
		return application;
	}
	public void setApplication(String application) {
		this.application = application;
	}
	public Set<Build> getBuilds() {
		return builds;
	}
	public void setBuilds(Set<Build> builds) {
		this.builds = builds;
	}
	public Status getStatus() {
		return status;
	}
	public void setStatus(Status status) {
		this.status = status;
	}
	public DASUser getAuthor() {
		return author;
	}
	public void setAuthor(DASUser author) {
		this.author = author;
	}

	public Date getCreatedAt() {
		return createdAt;
	}
	
	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}
	public Version getVersion() {
		return version;
	}
	public void setVersion(Version version) {
		this.version = version;
	}
	public List<RevisionHistory> getHistories() {
		return histories;
	}
	public void setHistories(List<RevisionHistory> histories) {
		this.histories = histories;
	}
	
}
